<template>
	<view class="all_body">
		<view class="" class="title">
			登录
		</view>
		<view class="baby_container">
			<view class="baby_img">
				<image src="../../static/image/cat.jpeg" mode=""></image>
			</view>
			
			<view class="bady_input">
				<view class="input_item">
					<input type="text" value="" placeholder="请输入账号" v-model="username" />
				</view>
				<view class="input_item" >
					<input  value="" placeholder="请输入密码"  v-model="passwoord"  type="password"/>
				</view>
				
			<view class="baby_item_other">
				
				<view class="item_detail" @click="changeMethodsLogin()">
					验证码登录
				</view>
				<view class="item_detail" @click="gotoForgetPwd()">
						忘记密码
				</view>
			</view>
			
				<view class="btn_user_login">
					<button type="default" @click="user_login()">登录</button>
				</view>
				
				
			</view>
			
			
		
			<view class="foot_reg" @click="gotoReg()">
				<text>没有账号? 立即注册</text>
			</view>	
		</view>
	
		
		
	</view>	
</template>

<script>
	import request from "../../static/utils/request.js"
  export default {
	  data(){
		  return {
			  username:'孙一飞',
			  passwoord:'55555555'
		  }
	  },
	  methods:{
		  user_login(){
			  let parmas  = {
				  us:this.username,
				  ps:this.passwoord
			  }
			 request("POST","login",parmas).then(res=>{
				 console.log(res)
				 if(res.data.err==0){
					 uni.showToast({
					 	title:"登陆成功"
					 })
					 uni.setStorage({
					 	key:"user",
						data:res.data.userInfo,
						success() {
							console.log("存储成功")
						}
						
					 })
				uni.navigateTo({
					url:"../home/home"
				})	 
				 }else{
					 uni.showToast({
					 	title:"登陆失败",
						icon:"loading"
					 })
				 }
			 })
		
		  },
		  changeMethodsLogin(){
			  uni.navigateTo({
			  	url:"mailLogin"
			  })
		  },
		  gotoReg(){
			  uni.navigateTo({
			  	url:"../reg/reg"
			  })
		  },
		  gotoForgetPwd(){
			  uni.navigateTo({
			  	url:"../forgetPwd/forgetPwd"
			  })
		  }
	  }
	  
	  
	  
	  
	  
  }	
	
	
	
</script>

<style lang="less">
	.title{
		width: 100%;
		height: 100rpx;
		// background-color: black;
		margin-top: 50rpx;
		text-align: center;
		font-weight: 400;
		font-size: 45rpx;
	}
	.baby_container{
		width: 80%;
		height: 70%;
		// background: pink;
		border: 1rpx solid rgba(187, 187, 187,0.1);;
		box-shadow: 0 0 40rpx rgba(170, 170, 170,1);
		margin: auto;
		padding-top: 40rpx;
		box-shadow:5px black ;
		position: relative;
		.baby_img{
			width: 100%;
			height: 260rpx;
			// background: yellow;
			display: flex;
			justify-content: center;
			align-items: center;
			image{
				width: 180rpx;
				height: 180rpx;
				border-radius: 50%;
				
			}
		}
		.bady_input{
			width: 100%;
			height: 40%;
			// background: black;
			margin-bottom: 100rpx;
			.input_item{
				width: 80%;
				height: 20%;
				// background: white;
				margin: auto;
	
			   
            	input{
					width: 100%;
					height: 100%;
					border-radius: 10%;
					margin: 30rpx;
					font-size: 25rpx;
			        border-radius: 40rpx;
			        border: 1rpx solid black;
					transform: translateX(-30rpx);
			        text-align: center;
				}			
			}
		}
		.baby_item_other{
			display: flex;
			justify-content: space-around;
			align-items: center;
			font-size: 25rpx;
			padding-top: 20rpx;
			.item_detail{
				width: 100%;
				text-align: center;
			}
		}
		.btn_user_login{
			margin-top: 70rpx;
			width: 100%;
			height:20%;
		    
			button{
				width: 80%;
				border-radius: 50rpx;
				color: #fff;
				background: rgba(51, 54, 67, 1)
		
			}
		}
		.foot_reg{
			position: absolute;
			bottom: 0;
			width: 300px;
			height: 100rpx;
			// background: pink;
			text-align: center;
			font-size: 25rpx;
			
		}
	}
	
	
</style>
